package com.eralink.unionuhfreader.util;

import android.content.Context;
import android.widget.Toast;

import com.eralink.unionuhfreader.MainActivity;
import com.eralink.unionuhfreader.MyApplication;

public class ToastUtil {
    private static Context context;
    private static Context getContext() {
        if(context == null) {
            context = MyApplication.getInstance().getApplicationContext();
        }
        return context;
    }
    public static void showShortToast(String msg) {
        Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
    }

    public static void showLongToast(String msg) {
        Toast.makeText(getContext(), msg, Toast.LENGTH_LONG).show();
    }

    public static void showToast(String msg) {
        showShortToast(msg); //默认showShortToast
    }

}
